import {
  q as o,
  p as V,
  ap as M,
  X as v,
  f as R,
  H as T,
  av as B,
  aw as H,
  k as e,
  m as i,
  l as s,
  az as O,
  as as r,
  aG as j,
  at as y
} from "./index-30f27935.js";
import { h as E } from "./vip-8a4bc37f.js";
function P(F) {
  const p = o([]),
    n = o(!0);
  o({}), V();
  const x = o(1),
    h = o(10),
    b = M("reload"),
    m = v({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    C = v({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    w = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: t }) => !t.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: t }) => !t.includes("序号列")
      },
      { label: "ID", prop: "user_id", minWidth: 50 },
      { label: "用户名", prop: "user_name", minWidth: 80 },
      { label: "手机号", prop: "user_phone", minWidth: 100 },
      {
        label: "身份",
        prop: "user_place",
        minWidth: 80,
        formatter: ({ user_place: t }) => {
          if (t == 0)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("暂无")] }
            );
          if (t == 1)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("一星合伙人")] }
            );
          if (t == 2)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("二星合伙人")] }
            );
          if (t == 3)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("三星合伙人")] }
            );
          if (t == 4)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("四星合伙人")] }
            );
          if (t == 5)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("五星合伙人")] }
            );
          if (t == 6)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("一星联创")] }
            );
          if (t == 7)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("二星联创")] }
            );
          if (t == 8)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("三星联创")] }
            );
          if (t == 9)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("四星联创")] }
            );
          if (t == 10)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("一星董事")] }
            );
          if (t == 11)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("二星董事")] }
            );
          if (t == 12)
            return e(
              s("el-tag"),
              { class: "mx-1", type: "success", effect: "light" },
              { default: () => [i("三星董事")] }
            );
        }
      },
      {
        label: "合伙人",
        prop: "leftHe",
        minWidth: 120,
        formatter: ({
          leftHe1: t,
          rightHe1: a,
          leftHe2: u,
          rightHe2: f,
          leftHe3: c,
          rightHe3: l
        }) =>
          e("div", null, [
            " ",
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左合1：" + t] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右合1：" + a] }
              )
            ]),
            e("div", null, [
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左合2：" + u] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右合2：" + f] }
              )
            ]),
            e("div", null, [
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左合3：" + c] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右合3：" + l] }
              )
            ])
          ])
      },
      {
        label: "联创",
        prop: "leftLian",
        minWidth: 120,
        formatter: ({
          leftLian1: t,
          rightLian1: a,
          leftLian2: u,
          rightLian2: f,
          leftLian3: c,
          rightLian3: l
        }) =>
          e("div", null, [
            " ",
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左联1：" + t] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右联1：" + a] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左联2：" + u] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右联2：" + f] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左联3：" + c] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右联3：" + l] }
              )
            ])
          ])
      },
      {
        label: "分公司1-3",
        prop: "leftLian",
        minWidth: 120,
        formatter: ({
          leftFen1: t,
          rightFen1: a,
          leftFen2: u,
          rightFen2: f,
          leftFen3: c,
          rightFen3: l
        }) =>
          e("div", null, [
            " ",
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分1：" + t] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分1：" + a] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分2：" + u] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分2：" + f] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分3：" + c] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分3：" + l] }
              )
            ])
          ])
      },
      {
        label: "分公司4-6",
        prop: "leftLian",
        minWidth: 120,
        formatter: ({
          leftFen4: t,
          rightFen4: a,
          leftFen5: u,
          rightFen5: f,
          leftFen6: c,
          rightFen6: l
        }) =>
          e("div", null, [
            " ",
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分4：" + t] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分4：" + a] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分5：" + u] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分5：" + f] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分6：" + c] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分6：" + l] }
              )
            ])
          ])
      },
      {
        label: "分公司7-9",
        prop: "leftLian",
        minWidth: 120,
        formatter: ({
          leftFen7: t,
          rightFen7: a,
          leftFen8: u,
          rightFen8: f,
          leftFen9: c,
          rightFen9: l
        }) =>
          e("div", null, [
            " ",
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分7：" + t] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分7：" + a] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分8：" + u] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分8：" + f] }
              )
            ]),
            e("div", null, [
              " ",
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["左分9：" + c] }
              ),
              e(
                s("el-tag"),
                { class: "mx-1", type: "success", effect: "light" },
                { default: () => ["右分9：" + l] }
              )
            ])
          ])
      },
      { label: "操作", fixed: "right", width: 100, slot: "operation" }
    ],
    W = R(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function S(t) {
    O(t);
  }
  async function A(t) {
    const a = { role_id: t.role_id },
      u = JSON.stringify(a),
      c = { value: r.enc.Base64.stringify(r.enc.Utf8.parse(u)) },
      l = await j(c);
    l.code == 200
      ? (y("删除成功", { type: "success" }), b())
      : y(l.msg, { type: "error" });
  }
  function L() {}
  function k(t) {
    (h.value = t), d(void 0, t);
  }
  function I(t) {
    (x.value = t), d(t, void 0);
  }
  function J(t) {}
  function z(t) {
    (C.text = `正在加载第${t}页...`),
      (n.value = !0),
      B(600).then(() => {
        n.value = !1;
      });
  }
  async function D(t) {
    n.value = !0;
    const a = {
        page: 1,
        pagesize: h.value,
        user_phone: t.user_phone,
        action: "sheng"
      },
      u = JSON.stringify(a),
      c = { value: r.enc.Base64.stringify(r.enc.Utf8.parse(u)) },
      { data: l } = await E(c);
    (p.value = l.data),
      (m.total = l.total),
      setTimeout(() => {
        n.value = !1;
      }, 500);
  }
  async function d(t = x.value, a = h.value) {
    const f = JSON.stringify({ page: t, pagesize: a, action: "busheng" }),
      l = { value: r.enc.Base64.stringify(r.enc.Utf8.parse(f)) },
      g = await E(l);
    g.code === 200
      ? ((p.value = g.data.data),
        (m.total = g.data.total),
        setTimeout(() => {
          n.value = !1;
        }, 500))
      : y(g.msg, { type: "error" });
  }
  function U({ row: t }) {
    return t.status == 0 ? "" : { background: "#FFE8E7" };
  }
  const N = t => {
    t && (t.resetFields(), location.reload());
  };
  return (
    T(() => {
      B().then(() => {
        const { setWatermark: t } = H(F.value.getTableDoms().tableWrapper);
        t("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        d();
    }),
    {
      loading: n,
      columns: w,
      dataList: p,
      pagination: m,
      buttonClass: W,
      onSearch: D,
      handleList: d,
      resetForm: N,
      handleaddUser: L,
      handleUpdate: S,
      handleDelete: A,
      handleSizeChange: k,
      handleCurrentChange: I,
      handleSelectionChange: J,
      onCurrentChange: z,
      cellStyle: U
    }
  );
}
export { P as useRole };
